let channel: Map<string,any> = new Map()

class lisent {
    item?: string 
    lisent(item:string,func: Function){
        channel.set(item,func)
        this.item = item
    }
    close(){
        if(this.item != undefined){
            channel.delete(this.item)
        }
        console.log("取消事件:"+this.item)
        console.log(channel)
    }
}
function send_channel(item: string,data: any){
    let func = channel.get(item)
    if(func != null){
        func(data)
    }else{
        console.log("事件没被监听! 事件名: " + item)
    }
}
export  {send_channel}
export { lisent } 
